﻿using System;
using System.Collections.Generic;

namespace Flickr.Owin.Security.FlickrOAuth
{
    internal class OAuthRequestToken
    {
        public string Token { get; set; }

        public string TokenSecret { get; set; }

        public bool CallbackConfirmed { get; set; }

        internal static OAuthRequestToken ParseResponse(string response)
        {
            Dictionary<string, string> dictionary = UtilityMethods.StringToDictionary(response);
            return new OAuthRequestToken()
            {
                Token = dictionary["oauth_token"],
                TokenSecret = dictionary["oauth_token_secret"],
                CallbackConfirmed = string.Equals(dictionary["oauth_callback_confirmed"], "true", StringComparison.InvariantCulture),
            };
        }
    }
}